﻿<Page xmlns:Input="using:Telerik.UI.Xaml.Controls.Input" 
    x:Class="Antares.VIEWs.ProjectInformationSubPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Antares.VIEWs"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Converters="using:Antares.Converters"
      mc:Ignorable="d">
    <Page.Transitions>
        <TransitionCollection>
            <EdgeUIThemeTransition Edge="Right"/>
        </TransitionCollection>
    </Page.Transitions>
    <Page.Resources>
        <Style x:Key="CommonTextStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI"/>
            <Setter Property="FontSize" Value="24"/>
            <Setter Property="FontWeight" Value="ExtraLight"/>
            <Setter Property="Foreground" Value="#FF222222"/>
        </Style>
        <Style x:Key="CommonTextBoxStyle" TargetType="TextBox">
            <Setter Property="FontFamily" Value="Segoe UI"/>
            
            <Setter Property="FontWeight" Value="ExtraLight"/>
            <Setter Property="Height" Value="41"/>
            <Setter Property="BorderBrush" Value="#FF3C81BA"/>
            <Setter Property="Foreground" Value="#FF555555"/>
            
            <Setter Property="FontSize" Value="22"/>
            <Setter Property="BorderThickness" Value="1"/>
            
        </Style>

        <Converters:StringToDateTimeConverter x:Key="StringToDateTimeConverter"/>
        <Converters:StringToRoleConverter x:Key="StringToRoleConverter"/>
        <Converters:BooleanNegationConverter x:Key="BooleanNegationConverter" />
        <Converters:BoolToOpacityConverter x:Key="BoolToOpacityConverter" />
        <Converters:BoolToForegroundConverter x:Key="BoolToForegroundConverter" />
        <Converters:RoleToIconConverter x:Key="RoleToIconConverter" />
    </Page.Resources>
   
    <Grid Background="LightBlue" >
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="50"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="50"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="50"/>
            <RowDefinition Height="*"/>
            
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="1.5*"/>
            <ColumnDefinition Width="40"/>
            <ColumnDefinition Width="1.5*"/>
            <ColumnDefinition Width="40"/>
            <ColumnDefinition Width="1.5*"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="50"/>
        </Grid.ColumnDefinitions>
        <Rectangle Grid.RowSpan="11" Grid.ColumnSpan="10" Stroke="#888888" StrokeThickness="1" StrokeDashArray="0.6,0,0.6" Fill="White"></Rectangle>
        <TextBlock Grid.Column="1" Grid.Row="1" Style="{StaticResource CommonTextStyle}" Text="{Binding Resource[Prj_Name]}"/>
        <TextBox TextChanged="TextBox_TextChanged_1" IsReadOnly="{Binding ReadOnly}" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="2" Style="{StaticResource CommonTextBoxStyle}" Text="{Binding Information.Name, Mode=TwoWay}"/>

        <TextBlock Grid.Column="5" Grid.Row="1" Style="{StaticResource CommonTextStyle}" Text="{Binding Resource[Prj_Status]}"/>
        <ComboBox ItemsSource="{Binding AllStatus}" IsEnabled="{Binding ReadOnly, Converter={StaticResource BooleanNegationConverter}}"  Grid.Column="5" SelectionChanged="ComboBox_SelectionChanged_1" Grid.Row="2" SelectedIndex="{Binding Information.Status, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="#FF555555" BorderBrush="#FF3C81BA"  BorderThickness="1">
        </ComboBox>

        <TextBlock Grid.Column="1" Grid.Row="4" Style="{StaticResource CommonTextStyle}" Text="{Binding Resource[Prj_Description]}"/>
        <TextBox TextChanged="TextBox_TextChanged_1" IsReadOnly="{Binding ReadOnly}" Grid.Column="1" Grid.ColumnSpan="5" Grid.Row="5" Style="{StaticResource CommonTextBoxStyle}" Text="{Binding Information.Description, Mode=TwoWay}"/>

        <TextBlock Grid.Column="1" Grid.Row="7" Style="{StaticResource CommonTextStyle}" Text="{Binding Resource[Prj_StartDate]}"/>
        <Input:RadDatePicker ItemLength="105" IsReadOnly="{Binding ReadOnly}" ValueChanged="RadDatePicker_ValueChanged_1" Grid.Column="1" Grid.Row="8" HorizontalAlignment="Stretch" Value="{Binding Information.StartDate, Converter={StaticResource StringToDateTimeConverter}, Mode=TwoWay}" VerticalAlignment="Stretch" Foreground="#FF3C81BA"  BorderBrush="#FF3C81BA"  BorderThickness="1"/>

        <TextBlock Grid.Column="3" Grid.Row="7" Style="{StaticResource CommonTextStyle}" Text="{Binding Resource[Prj_EndDate]}"/>
        <Input:RadDatePicker ItemLength="105" IsReadOnly="{Binding ReadOnly}" ValueChanged="RadDatePicker_ValueChanged_1" Grid.Column="3" Grid.Row="8" HorizontalAlignment="Stretch" Value="{Binding Information.EndDate, Converter={StaticResource StringToDateTimeConverter}, Mode=TwoWay}" VerticalAlignment="Stretch" Foreground="#FF3C81BA"  BorderBrush="#FF3C81BA" Background="White" BorderThickness="1"/>

        <StackPanel x:Name="CommandArea" Grid.Column="5" Grid.Row="10" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Command="{Binding SaveCommand}" IsEnabled="{Binding ReadOnly, Converter={StaticResource BooleanNegationConverter}}" Style="{StaticResource BigSaveButtonStyle}" x:Name="Save" AutomationProperties.Name="{Binding Resource[Prj_Save]}" VerticalAlignment="Top" />
            <Button Command="{Binding DeleteCommand}" Style="{StaticResource DiscardButtonStyle}" IsEnabled="{Binding ReadOnly, Converter={StaticResource BooleanNegationConverter}}" Margin="-10,11,-25,0" x:Name="Delete" VerticalAlignment="Top" AutomationProperties.Name="{Binding Resource[Prj_Delete]}" />
        </StackPanel>

        <Rectangle Grid.Column="7" Grid.ColumnSpan="3" Grid.RowSpan="11" x:Name="MemberBackground"  Fill="#f1f6fa" Margin="0,0.6,0.6,1" />
       
        <TextBlock Grid.Column="8" Grid.Row="1" Style="{StaticResource CommonTextStyle}" FontWeight="SemiBold" Text="{Binding Resource[Prj_Member]}"/>
        <ListView SelectionMode="None" ItemsSource="{Binding Information.Members}" Grid.Column="8" Grid.Row="2" Grid.RowSpan="8" Background="White" BorderBrush="#FF3C81BA" BorderThickness="1"  >
            <ListView.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Tapped="StackPanel_Tapped_1" >
                        <Grid>
                            <Image Opacity="{Binding IsConfirmed, Converter={StaticResource BoolToOpacityConverter}}" Source="{Binding Role, Converter={StaticResource RoleToIconConverter}}" Height="{Binding ActualHeight, ElementName=Member}" Width="{Binding ActualHeight, ElementName=Member}" />
                            <Image Opacity="{Binding IsConfirmed, Converter={StaticResource BoolToOpacityConverter}}" Source="../Assets/confirmed.png" Height="{Binding ActualHeight, ElementName=Member}" Width="{Binding ActualHeight, ElementName=Member}" Visibility="{Binding IsActive, Converter={StaticResource BoolToForegroundConverter}}" />
                        </Grid>
                        <TextBlock x:Name="Member" Style="{StaticResource CommonTextStyle}" FontSize="18" Margin="10,0,0,0" Text="{Binding Username}"/>
                        <!--<TextBlock Style="{StaticResource CommonTextStyle}"   FontSize="18" Margin="20,0,10,0" Text="{Binding Role, Converter={StaticResource StringToRoleConverter}}"/>-->
                    </StackPanel>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
            <Border Grid.Column="8" Grid.Row="9" Margin="1,0,1,1" Background="#e8e8e8" BorderThickness="0,1,0,0" BorderBrush="#bbb4b4"  />
            <Grid Grid.Column="8" Grid.Row="9">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>

            <TextBox TextChanged="Candidate_TextChanged_1" Margin="3,1,0,1" Height="auto" x:Name="Candidate" Grid.Column="0"  Style="{StaticResource CommonTextBoxStyle}" Text="{Binding Resource[Prj_EnterUsername]}" BorderThickness="0" Background="#e8e8e8" Foreground="#222222" FontSize="28" GotFocus="Candidate_GotFocus" LostFocus="Candidate_LostFocus"  />
            <Button IsEnabled="{Binding ReadOnly, Converter={StaticResource BooleanNegationConverter}}" ToolTipService.ToolTip="{Binding Resource[ToolTip_AddMember]}" Command="{Binding AddMemberCommand}" CommandParameter="{Binding Text, ElementName=Candidate}" HorizontalAlignment="Right" Grid.Column="1" Style="{StaticResource AddFriendButtonStyle}" Margin="0,-8,5,-12" x:Name="AddMember" VerticalAlignment="Top" Background="{x:Null}" Width="70" Height="70"/>
        <ProgressRing x:Name="pgrRing" Height="50" Width="50" Opacity="0.7" IsActive="True" Visibility="Collapsed" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="1"  />
        </Grid>
        <Rectangle Grid.Column="7" Grid.ColumnSpan="3" Grid.RowSpan="11" x:Name="HidememberArea"  Fill="#f1f6fa" Margin="0,0.6,0.6,1" />
    </Grid>
    
</Page>